package com.beauty.dressing.module.market.activity;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.LinearLayout;

import com.beauty.dressing.R;
import com.beauty.dressing.common.base.BaseActivity;
import com.beauty.dressing.module.common.view.BannerLayout;
import com.beauty.dressing.module.market.adapter.MarketDetailAdapter;
import com.beauty.dressing.module.market.holder.DetailHeaderHolder;
import com.beauty.dressing.module.person.activity.LoginActivity;
import com.framework.library.haorefresh.HaoRecyclerView;

public class MarketDetailActivity extends BaseActivity {
    protected HaoRecyclerView mListView;
//    protected RecyclerView recyclerView;
    private MarketDetailAdapter mAdapter;
    private BannerLayout mBannerHeader;
    private LinearLayout mAddLayout;

    public static void startActivity(Context context){
        Intent intent = new Intent(context,MarketDetailActivity.class);
        context.startActivity(intent);
    }
    @Override
    public void setContentView() {
        setContentView(R.layout.market_detail_activity);
    }

    @Override
    public void findView() {
//        mListView = (HaoRecyclerView) findViewById(R.id.hao_recycleview);
        findViewById(R.id.left_img_btn).setOnClickListener(this);
        findViewById(R.id.add_shopcar_txt).setOnClickListener(this);
        findViewById(R.id.buy_txt).setOnClickListener(this);
        mAddLayout = findViewById(R.id.add_layout);
        mBannerHeader = new BannerLayout(context);
//        GridLayoutManager gridLayoutManager = new GridLayoutManager(context, 2);
//        gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
//            @Override
//            public int getSpanSize(int position) {
//                return mAdapter.getItemViewType(position) == MarketDetailAdapter.ViewType.DETAIL_ITEM ? 1 : 2;
//            }
//        });
//        mListView.setLayoutManager(gridLayoutManager);
//        mListView.addOnScrollListener(FrescoUtil.getPauseOnScrollListener());
    }

    @Override
    public void initData() {
        mAdapter = new MarketDetailAdapter(context);
        DetailHeaderHolder detailHeaderHolder = new DetailHeaderHolder(context,mInflater,mAddLayout);
//        mAdapter.addHeaderView(detailHeaderHolder.itemView);
        mAddLayout.addView(detailHeaderHolder.itemView);
        detailHeaderHolder.bindData(null,0);
//        mListView.setAdapter(mAdapter);
//        mList.add(new GroupNavigation(0,"组4",true,true));
//        for (int i=0;i<10;i++){
//            mList.add(new DetailImage());
//        }
//        mListView.setAdapter(mAdapter);
//        mAdapter.setChild(mList);
//        List<Object> adList = new ArrayList<>();
//        for (int i=0;i<3;i++){
//            adList.add(new BaseBean());
//        }
//        mBannerHeader.setBannerPagerAdapter(adList,true);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.left_img_btn:
                finish();
                break;
            case R.id.add_shopcar_txt:
            case R.id.buy_txt:
                LoginActivity.startActivity(context);
                break;
        }
    }
}
